package com.example.text.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.text.entity.Ware;
import org.apache.ibatis.annotations.*;

import java.util.List;


@Mapper
public interface WareMapper  {




    @Insert("insert into ware(ware_name, ware_phone, ware_ton, ware_free_day, ware_manger, ware_rate) " +
            "values(#{WareName}, #{WarePhone}, #{WareTon}, #{WareFreeDay}, #{WareManger}, #{WareRate})")
    void insert(Ware ware);

    @Update("update ware set ware_name=#{WareName}, ware_phone=#{WarePhone}, ware_ton=#{WareTon}, ware_free_day=#{WareFreeDay}, " +
        "ware_manger=#{WareManger}, ware_rate=#{WareRate} where ware_id=#{WareId}")
    void updateWare(Ware ware);


    @Update("update ware set delete_flag=0 where ware_id=#{wareId}")
    void deleteWare(Integer wareId);

    @Select("select * from ware where delete_flag=1")
    List<Ware> selectAllWare();
    @Select("select * from ware where delete_flag=1 and ware_id=#{wareId}")
    Ware selectWareById(Integer wareId);

    @Select("select * from ware where delete_flag=1 and ware_name=#{wareName}")
    List<Ware> selectWareByName(String wareName);
}